<?php
    /******************************************************************************
     *    Copyright ZhangYue
     * Author:                Quinn Xu
     * Description:           
     * Want argument:         
     * Output:                
     * Create Date:           2012-12-18
     *****************************************************************************/
    class peizhiguanli
    {
        private $shujubiao = 'peizhi';
        //查询配置列表
        public function huoqupeizhiliebiao()
        {
            global $db;
            $query = "SELECT * FROM {$this->shujubiao} WHERE yincang=0";
            return $db->query($query);
        }
        
        //设置属性值
        public function peizhishuxingzhi($model)
        {
            global $db;
            $query = "UPDATE {$this->shujubiao} SET shuxingzhi='{$model->getShuxingzhi()}' where id='{$model->getId()}'";
            $db->execute($query);
			return $db->affected_rows();
        }
        
        //根据属性名设置属性值
        public function tongguoshuxingmingpeizhishuxingzhi($model)
        {
            global $db;
            $query = "UPDATE {$this->shujubiao} SET shuxingzhi='{$model->getShuxingzhi()}' where shuxingming='{$model->getShuxingming()}'";
            $db->execute($query);
			return $db->affected_rows();
        }
        
        //根据id获取属性值
        public function huoqushuxingzhi($model)
        {
            global $db;
            $query = "SELECT * FROM {$this->shujubiao} WHERE id='{$model->getId()}'";
            return $db->query($query);
        }
        
        //根据属性名获取属性值
        public function tongguoshuxingminghuoqushuxingzhi($model)
        {
            global $db;
            $query = "SELECT * FROM {$this->shujubiao} WHERE shuxingming='{$model->getShuxingming()}'";
            return $db->query($query);
        }
    }
?>